<template>
    项目名称：<input type="text" v-model="Name"/>
    <button @click="ShowInvest">查询</button>
<table border="1">
    <tr>
        <td>理财编号</td>
        <td>项目名称</td>
        <td>年收益</td>
        <td>月收益</td>
        <td>最低金额</td>
        <td>理财人数</td>
        <td>风险等级</td>
        <td>操作</td>
    </tr>
    <tr v-for="i in data">
        <td>{{ i.Iid }}</td>
        <td>{{ i.Iname }}</td>
        <td>{{ i.Ymoney }}</td>
        <td>{{ i.Mmoney }}</td>
        <td>{{ i.Minmoney }}</td>
        <td>{{ i.Inum }}</td>
        <td>{{ i.Level}}</td>
        <td><a href="#" @click="Go(i.Iid)">修改</a></td>
    </tr>
</table>
</template>
<script setup lang="ts">
import axios from 'axios';
import{onMounted, ref}from'vue'
import { useRouter } from 'vue-router';
const router = useRouter();
const Name=ref('')
const data=ref(
    [
        {
            Iid:0,
            Iname:'',
            Ymoney:0,
            Mmoney:0,
            Minmoney:0,
           Inum:0,
            Level:0
        }
    ]
)
onMounted(()=>{
    ShowInvest()
})
const ShowInvest=()=>{
    axios.get('https://localhost:44327/api/Lx/ShowInvest',
        {
            params:{
                Iname:Name.value
            }
        }
    ).then(
        res=>{
            data.value=res.data
        }
    ).catch(
        err=>{
            console.log(err);
        }
    )
}
const Go=(Iid:number)=>{
    router.push(
        {
            name:'UpdateInvest',
            params:{Iid:Iid}
        }
    )
}

</script>